|
|
|
|
|
|
|
Adding Help Functions to Menus |
|
|
|
|
|
|
|
|
You see Contents, Search, Help on Help, and About menu items on the Help menu of most Windows applications. The purpose of this exercise is to show you how to add these items to your Visual Basic database application. |
|
|
|
|
|
|
|
|
Start by opening a new project and building the following menu by choosing Menu Editor . . . from Visual Basic's Tools menu: |
|
|
|
|
|
|
|
|
Save this form as HELPMENU.FRM and the project as HELPMENU.VBP. |
|
|
|
|
| |
|
|
|
|
The code in this example can either be entered manually or taken from the CD that ships with this book. |
|
|
|
|
|
|
|
|
|
|
Now enter the following code in the Form_Load procedure of your HELPMENU.FRM file: |
|
|
|
|
|
|
|
|
Private Sub Form_Load ()
'assign the help file to use (insert your path)
App.HelpFile = "C:\TYSDBVB5\SOURCE\APPXB\HELP\PROJECT.HLP"
End Sub |
|
|
|
|
|
|
|
|
The line App.HelpFile = "C:\TYSDBVB5\SOURCE\APPXB\HELP\PROJECT.HLP defines the help file for the project. |
|
|
|
|
|
|
|
|
Next, create a new module by selecting Add Module from the Project menu, name it PRCHELP.BAS, and insert the following code inside the general declaration section: |
|
|
|
|
|
|
|
|
Option Explicit
#If Win16 Then
Declare Function WinHelp Lib "User" (ByVal hwnd As Integer,
_ ByVal lpHelpFile As String, ByVal wCommand As Integer,
_ ByVal dwData As Any) As Integer
Declare Sub ShellAbout Lib "shell.dll" (ByVal hWindOwner As Integer,
_ ByVal lpszAppName As String, ByVal lpszMoreInfo As String,
_ ByVal hIcon As Integer) |
|
|
|
|
|